/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.insurance.service;

import cn.hutool.core.date.DateTime;
import me.zhengjie.modules.insurance.domain.InsuredApply;
import me.zhengjie.modules.insurance.pojo.*;
import me.zhengjie.modules.insurance.service.dto.InsuredApplyDto;
import me.zhengjie.modules.insurance.service.dto.InsuredApplyQueryCriteria;
import org.springframework.data.domain.Pageable;

import java.util.Date;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
* @website https://el-admin.vip
* @description 服务接口
* @author HeHui
* @date 2022-01-03
**/
public interface InsuredApplyService {

    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(InsuredApplyQueryCriteria criteria, Pageable pageable);

    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<InsuredApplyDto>
    */
    List<InsuredApplyDto> queryAll(InsuredApplyQueryCriteria criteria);

    /**
     * 根据ID查询
     * @param id ID
     * @return InsuredApplyDto
     */
    InsuredApplyDto findById(Long id);

    /**
    * 创建
    * @param resources /
    * @return InsuredApplyDto
    */
    InsuredApplyDto create(InsuredApply resources);

    /**
    * 编辑
    * @param request /
    */
    void update(InsuredApplyRequest request, long userId);

    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<InsuredApplyDto> all, HttpServletResponse response) throws IOException;


    /**
     * 存在用户申请
     *
     * @param insuredUserId 被保险人的用户id
     * @param start         开始
     * @param end           结束
     * @return boolean
     */
    boolean existsUserApply(long insuredUserId, Date start, Date end);

    /**
     * 存在身份证申请
     *
     * @param userIdCard 用户id卡
     * @param start      开始
     * @param end        结束
     * @param notId      没有身份证
     * @return boolean
     */
    boolean existsIdApply(String userIdCard,Date start, Date end, Long notId);

    /**
     * 新增案件生气
     *
     * @param request       请求
     * @param currentUserId 当前用户id
     * @return long
     */
    long apply(InsuredApplyRequest request, long currentUserId);

    /**
     * 得到案件处理细节
     *
     * @param id id
     * @return {@link InsuredApplyHandlerDetailsResponse}
     */
    InsuredApplyHandlerDetailsResponse getHandlerDetails(long id);

    /**
     * 处理
     *
     * @param request       请求
     * @param currentUserId 当前用户id
     */
    void handler(InsuredApplyHandlerRequest request, long currentUserId);

    /**
     * 加载更新数据
     *
     * @param id id
     * @return {@link InsuredApplyRequest}
     */
    InsuredApplyRequest loadUpdateData(long id);

    /**
     * 更新理赔员
     *
     * @param ids               id
     * @param responsibleUserId 负责用户id
     * @param currentUserId     当前用户id
     */
    void updateUser(List<Long> ids, long responsibleUserId, long currentUserId);

    /**
     * 统计当前用户 指定时间内人沟通案件数
     *
     * @param start         开始
     * @param end           结束
     * @param currentUserId 当前用户id
     * @return {@link Integer}
     */
    Integer countNextTime(Date start, Date end, long currentUserId);

    /**
     * 手机号码匹配匹配
     *
     * @param mobile 移动
     * @param start  开始
     * @param end    结束
     * @return {@link InsuredApplyRequest}
     */
    InsuredApplyRequest mobileMatching(String mobile, Date start, Date end);

    /**
     * 补充文件
     *
     * @param docs 文档
     * @param id   id
     */
    void replenishDoc(List<String> docs, long id);

    /**
     * 查看进度
     *
     * @param id id
     * @return {@link InsuredCaseSpeedResponse}
     */
    InsuredCaseSpeedResponse getSpeed(long id);

    /**
     * 用户申请
     *
     * @param request 请求
     * @return {@link Long}
     */
    Long userApply(InsuredUserApplyRequest request);

    /**
     * 用户编辑
     *
     * @param request 请求
     */
    void userEdit(InsuredUserUpdateRequest request);

    /**
     * 统计
     *
     * @param criteria 标准
     * @return {@link Long}
     */
    Long count(InsuredApplyQueryCriteria criteria);
}